/*
 * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


// WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION!

import { int32, float32 } from "@koalaui/common"
import { KStringPtr, KBoolean, RuntimeType, runtimeType, isResource, isInstanceOf } from "@koalaui/interop"
import { NodeAttach, remember } from "@koalaui/runtime"
import { ComponentBase } from "./ComponentBase"
import { TypeChecker } from "#components"
import { ArkCommonMethodComponent } from "./ArkCommon"
import { ArkWindowScenePeer } from "./peers/ArkWindowScenePeer"
import { CommonMethod } from "./ArkCommonInterfaces"
import { WindowSceneAttribute } from "./ArkWindowSceneInterfaces"
import { Position } from "./ArkUnitsInterfaces"
/** @memo:stable */
export class ArkWindowSceneComponent extends ArkCommonMethodComponent {
    getPeer(): ArkWindowScenePeer {
        return (this.peer as ArkWindowScenePeer)
    }
    /** @memo */
    public setWindowSceneOptions(persistentId: number): this {
        if (this.checkPriority("setWindowSceneOptions")) {
            const persistentId_casted = persistentId as (number)
            this.getPeer()?.setWindowSceneOptionsAttribute(persistentId_casted)
            return this
        }
        return this
    }
    /** @memo */
    public attractionEffect(destination: Position, fraction: number): this {
        if (this.checkPriority("attractionEffect")) {
            const destination_casted = destination as (Position)
            const fraction_casted = fraction as (number)
            this.getPeer()?.attractionEffectAttribute(destination_casted, fraction_casted)
            return this
        }
        return this
    }
    public applyAttributesFinish(): void {
        // we calls this function outside of class, so need to make it public
        super.applyAttributesFinish()
    }
}

/** @memo */
export function ArkWindowScene(
  /** @memo */
  style: ((attributes: ArkWindowSceneComponent) => void) | undefined,
  /** @memo */
  content_: (() => void) | undefined,
  persistentId: number
) {
    const receiver = remember(() => {
        return new ArkWindowSceneComponent()
    })
    NodeAttach<ArkWindowScenePeer>((): ArkWindowScenePeer => ArkWindowScenePeer.create(receiver), (_: ArkWindowScenePeer) => {
        receiver.setWindowSceneOptions(persistentId)
        style?.(receiver)
        content_?.()
        receiver.applyAttributesFinish()
    })
}
